oo::class create PopupMenu {
    superclass AppMenu
    variable Menu Label NotebookObj Notebook
    
    constructor {menubar} {
        set Menu [menu .popupmenu -tearoff 0]        
    }

    method setNotebook {nbObj} {
        next $nbObj
        bind $Notebook <Button-3> "tk_popup $Menu %X %Y"
    }
    
    method createMenu {} {
        foreach row {
            {command {Copy C-c {} {}}}
            {command {Cut C-x {} {}}}
            {command {Paste C-v {} {}}}
            {separator {}}
            {command {Save C-s {} {}}}
            {command {Close C-q {} {}}}
        } {
            my createItem $row
        }
    }
    
    method update {textWidget langObj} {
        if ![$textWidget edit modified] {
            $Menu entryconfigure 4 -state disable
        } else {
            $Menu entryconfigure 4 -state normal
        }
    }
}